<template>
  <div class="cart">
    <nav-bar class="nav-bar">
      <div slot="center">购物车( {{length}} )</div>
    </nav-bar>
    <cart-list  />
    <cart-bottom-bar class="bottom-bar" />
  </div>
</template>

<script>
import NavBar from 'components/common/navbar/NavBar';
import CartList from './childComps/CartList';
import Scroll from 'components/common/scroll/Scroll';
import CartBottomBar from './childComps/CartBottomBar';

import {mapGetters} from "vuex";

export default {
  name: "Cart",
  components: {
    NavBar,
    CartList,
    Scroll,
    CartBottomBar
  },
  computed: {
    // 数组语法
    // ...mapGetters(['cartList', 'cartListLength'])
    // 对象语法
    ...mapGetters({
      length: 'cartListLength',
      list: 'cartList'
    })
  },
}
</script>

<style scoped>
.nav-bar {
  color: #fff;
  background-color: var(--color-tint);
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 50px;
}
</style>
